package com.tougutips.cookbook;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author MJ
 * description:
 * Date: 2022/7/20 -17:39
 * @Todo:
 */
@EnableTransactionManagement
@MapperScan(basePackages = "com.tougutips.cookbook.mapper")
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class CookbookApp {
    @Bean
    MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
    public static void main(String[] args) {
        SpringApplication.run(CookbookApp.class);
    }
}
